<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>vue life</title>
	<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
	<div id="app"></div>
	<script>
		//生命周期函数  某个时间点自动执行的函数
		var vue = new Vue({
			el: "#app",
			template: "<div>{{txt}}</div>",
			data: {
				txt: "hello word"
			},
			beforeCreate: function() {	//初始化之前
				console.log("beforeCreate")
			},
			created: function() {	//初始化完毕
				console.log("created")
			},
			beforeMount: function() {	//渲染之前
				console.log(this.$el)
				console.log("beforeMount")
			},
			mounted: function() {	//渲染结束
				console.log(this.$el)
				console.log("mounted")
			},
			beforeDestroy: function() {
				console.log("beforeDestory")
			},
			destroyed: function() {
				console.log("destory")
			},
			beforeUpdate: function() {	//数据改变渲染前
				console.log("beforeUpdate")
			},
			updated: function() {	//数据改变渲染结束
				console.log("updated")
			}
		})
	</script>
</body>
</html>